﻿<html>
<head>
<title>查看本地数据库</title>
<link rel="stylesheet" href="/css/def.css">
<link rel="stylesheet" href="/css/tab.css">
<script src="/js/p.js"></script>
</head>

<body class="MyBody">
<div id="divResultMsg" style="text-align: left; background-color: #C1FFE4;">
<table id="tabResultMsg" style="border: solid 0px #C1FFE4; text-align:left;color: #3E6373; display:none;">
<tr>
<td style="padding: 5px 0px 0px 10px;vertical-align: top;"></td>
<td style="padding-top:5px"><pre id="spanResultMsg" style=" font-size: 12px;">xx</pre></td>
</tr></table>
</div>
<div class="mtab">
	<ul>
		<li id="log1">启动日志</li>
		<li id="log2" class="mlast">诊断日志</li>
		<!-- 
		<li id="log3">运行时日志</li>
		<li id="log4">文件日志</li>
		 -->
	</ul>
</div>
<div class="mcont">
	<div style="display:none;" id="log1_cont"><pre id="spanStartLog">log1_cont</pre></div>
	<div style="display:none;" id="log2_cont">
		<div id="limitLogCate" style="float:left;border-right: 1px solid #BBBBBB;padding-left:10px;padding-right:10px;"></div>
		<div style="float: left;padding-left:10px;"><pre id="lmtLogDetail">请点击左边条目进行查看</pre></div>
	</div>
	<div style="display:none;" id="log3_cont">log3_cont</div>
	<div style="display:none;" id="log4_cont">log4_cont</div>
</div>

<div id="divHintMsg" style="position:absolute; top:0px; right:30px;font-size: 12px;padding: 2px 2px 2px 2px; z-index: 9901;background:#DDDDDD;filter:alpha(opacity=60);opacity:0.6; border: solid 1px #BCBCBC; display: none;"></div>

<script type="text/javascript">

var runtimetab={"selectedid":"","selecteditemid":""};

function initMtab(pId){
	var logtab = {"log1":"启动日志","log2":"诊断日志","log3":"运行时日志","log4":"文件日志"};
	for(var k in logtab){
		var elog = document.getElementById(k);
		elog.inited = "0";
		elog.onclick = function (){
			if(runtimetab["selectedid"] !== this.id){
				if(runtimetab["selectedid"] !== ""){
					var preSel = document.getElementById(runtimetab["selectedid"]);
					
					if(preSel.className === "mlastsel"){
						preSel.className = "mlast";
					}else{
						preSel.className = "";
					}
					
					var preCont = document.getElementById(runtimetab["selectedid"]+"_cont");
					preCont.style.display = "none";
				}

				if(this.className === "mlast"){
					this.className = "mlastsel";
				}else{
					this.className = "lisel";
				}
				var curCont = document.getElementById(this.id+"_cont");
				curCont.style.display = "";
				runtimetab["selectedid"] = this.id;
			}
			
			if(this.id === "log1" && this.inited==="0"){
				this.inited="1";
				getStartLog();
			}else if(this.id === "log2" && this.inited==="0"){
				this.inited="1";
				getLimitLogCat();
			}
		}
		
		
	}
	document.getElementById("log1").click();
}

function getLimitLogCat() {
	try {
		getHttpTimeout("/d/getLimitLogCat", 30, showLimitLogCat);
	}
    catch (err) {
        outputResultMsg("此页面存在一个错误。\n\n错误描述: " + err.description);
    }
}

function showLimitLogCat(){
	var cate = document.getElementById("limitLogCate");
	var jsonTxt = eval('('+this.responseText+')');
	var respCode = jsonTxt["respCode"];
	var respInfo = jsonTxt["respInfo"];
	if("0" == respCode.toString()){
		var dataList = jsonTxt["dataList"];
		for(var i=0; i<dataList.length; i++){
			var eachDataRow = dataList[i];
			var newNode = document.createElement("div");
			newNode.className = "mitem";
			newNode.id = eachDataRow["key"];
			newNode.innerHTML = eachDataRow["key"];
			newNode.onclick = function (){
				this.className = "mitemsel";
				if(runtimetab["selecteditemid"] !== this.id && runtimetab["selecteditemid"] !== ""){
					document.getElementById(runtimetab["selecteditemid"]).className = "mitem";
				}
				runtimetab["selecteditemid"] = this.id;
				getLimitLogDetail(this.id);
			}
			newNode.onmouseover = function (){
				if(runtimetab["selecteditemid"] !== this.id){
					this.className = "mitemom";
				}
			}
			newNode.onmouseout = function (){
				if(runtimetab["selecteditemid"] === this.id){
					this.className = "mitemsel";
				}else{
					this.className = "mitem";
				}
			}
			cate.appendChild(newNode);
		}
	}else{
		outputResultMsg(this.responseText);
	}
}

function getLimitLogDetail(pKey){
	try {
		document.getElementById("lmtLogDetail").innerHTML = "加载中...";
		var pData = "{\"key\":\""+encodeURI(pKey)+"\"}";
		postHttp("/d/getLimitLogDetail", pData, showLimitLogDetail, pKey);
	}
    catch (err) {
        outputResultMsg("此页面存在一个错误。\n\n错误描述: " + err.description);
    }
}

function showLimitLogDetail(pKey){
	document.getElementById("lmtLogDetail").innerHTML = this.responseText;
}


function doGetLog() {
	try {
		getHttpTimeout("/d/getStartLog", 30, showStartLog);
	}
    catch (err) {
        outputResultMsg("此页面存在一个错误。\n\n错误描述: " + err.description);
    }
}

function showStartLog(){
	document.getElementById("spanStartLog").innerHTML = this.responseText;
}

function getStartLog(){
	document.getElementById("spanStartLog").innerHTML = "加载中...";
	//setTimeout(function(){doGetLog();}, 50);
	doGetLog();
}
initMtab("");

</script>
</body></html>

